package io.renren.modules.generator.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.sun.security.auth.UserPrincipal;
import io.renren.common.utils.MapUtils;
import io.renren.common.utils.ShiroUtils;
import io.renren.modules.generator.entity.UHeroEntity;
import io.renren.modules.generator.service.UHeroService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.generator.entity.BasHeroEntity;
import io.renren.modules.generator.service.BasHeroService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2018-11-21 10:57:32
 */
@RestController
@RequestMapping("generator/battle")
public class BattleController {
    @Autowired
    private BasHeroService basHeroService;

    private UHeroService uHeroService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("generator:bashero:list")
    public R listForAtt(@RequestParam Map<String, Object> params){
        List<UHeroEntity> myHeros = uHeroService.selectByMap(new MapUtils().put("userId", ShiroUtils.getUserId()));
        List<UHeroEntity> defHeros = uHeroService.selectByMap(new MapUtils().put("userId", params.get("defId")));
        PageUtils page = basHeroService.queryPage(params);

        return R.ok().put("page", page);
    }


}
